#include "Chest.h"



Chest::Chest(LPDIRECT3DDEVICE9 device, int ID, ChestsS *chestArray,IXAnimator *XAnim, int* GameStateP, std::string* MessageP): InteractableObject(device,chestArray[ID].x,chestArray[ID].z,chestArray[ID].yrot)
{
	chestID = ID;
	ChestArrayP_= chestArray;
	loadModelXA(XAnim,device,"Chest.X");
	Model.nextAnimSet = 0;
	Radius = 15;
	interactRadius = Radius + 10;
	GameStateP_ = GameStateP;
	MessageP_ = MessageP;
}


Chest::~Chest(void)
{
}

void Chest::interact()
{
	std::ostringstream QtySS;
	QtySS << ChestArrayP_[chestID].Quantity;
	Model.nextAnimSet = 2;
	message.assign("You found ");
	message.append(QtySS.str());

	switch(ChestArrayP_[chestID].itemID)
	{
	case MONEY:
		message.append(" Money!");
		// add to inv
		break;
	case POTION:
		if (ChestArrayP_[chestID].Quantity > 1)
		message.append(" Potions!");
		else
		message.append(" Potion!");
		// add to inv
		break;
	case BITCHES:
		message.append(" Bitches , dawg!");
		// add to inv
		break;
	}
	MessageP_ ->assign(message);
	*GameStateP_ = DIALOGUE;
}

